import 'dart:ui';

import 'package:flutter/material.dart';
import 'email.dart';
import 'home.dart';
import 'pages.dart';
import 'airplay.dart';

class IndexPage extends StatefulWidget {
  @override
  _IndexPageState createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> {
  final _BottomNavigationColor = Colors.blue;
  int _currentIndex =0;
  List<Widget> lst = List();
  @override
  void initState(){
      lst..add(Home())
      ..add(Email())
      ..add(Pages())
      ..add(Airplay());
      super.initState();
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: lst[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(items: [
      BottomNavigationBarItem(
        icon: Icon(
          Icons.home,
          color: _BottomNavigationColor,
        ),
        title: Text('Home', style: TextStyle(color: _BottomNavigationColor)),
      ),
      BottomNavigationBarItem(
        icon: Icon(
          Icons.email,
          color: _BottomNavigationColor,
        ),
        title: Text('Email', style: TextStyle(color: _BottomNavigationColor)),
      ),
      BottomNavigationBarItem(
        icon: Icon(
          Icons.pages,
          color: _BottomNavigationColor,
        ),
        title: Text('Pages', style: TextStyle(color: _BottomNavigationColor)),
      ),
      BottomNavigationBarItem(
        icon: Icon(
          Icons.airplay,
          color: _BottomNavigationColor,
        ),
        title: Text('Airplay', style: TextStyle(color: _BottomNavigationColor)),
      )
    ],
    currentIndex: _currentIndex,
    onTap: (int index){
      setState(() {
          _currentIndex = index;
      });
    },
    ));
  }
}
